import type common from '@ohos.app.ability.common';

export class GlobalContext {
  private static context: common.UIAbilityContext;

  public static initContext(context: common.UIAbilityContext): void {
    GlobalContext.context = context;
  }

  public static getContext(): common.UIAbilityContext {
    return GlobalContext.context;
  }

  public static getObject(value: string): Object {
    return AppStorage.get(value);
  }

  public static setObject(key: string, objectClass: Object): void {
    AppStorage.setOrCreate(key, objectClass);
  }
}